package com.shopping.product.entity;

import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;

import java.io.Serializable;
import java.util.Date;

import com.shopping.common.valid.Add;
import com.shopping.common.valid.ListValue;
import com.shopping.common.valid.Update;
import com.shopping.common.valid.UpdateStatus;
import lombok.Data;
import org.hibernate.validator.constraints.URL;

import javax.validation.constraints.*;

/**
 * 品牌
 *
 * @author Europa
 * @date 2020-04-11 20:37:09
 */
@Data
@TableName("pms_brand")
public class BrandEntity implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 品牌id
     */
    @TableId
    @NotNull(message = "修改内容必须指定id", groups = Update.class)
    @Null(message = "新增不能指定id", groups = Add.class)
    private Long brandId;

    /**
     * 品牌名
     */
    @NotEmpty(message = "品牌名不能为空", groups = {Add.class, Update.class})
    private String name;

    /**
     * 品牌logo地址
     */
    @URL(message = "logo必须是一个合法的url地址", groups = {Add.class})
    @NotEmpty(message = "url不能为空", groups = {Add.class, Update.class})
    private String logo;

    /**
     * 介绍
     */
    @NotEmpty(message = "介绍不能为空", groups = {Add.class, Update.class})
    private String descript;

    /**
     * 显示状态[0-不显示；1-显示]
     */
    @ListValue(values = {0, 1}, groups = {Add.class, UpdateStatus.class})
    @NotNull(message = "显示状态不能为空")
    private Integer showStatus;

    /**
     * 检索首字母
     */
    @Pattern(regexp = "[A-z]", message = "检索首字母必须是一个字母", groups = {Add.class, Update.class})
    private String firstLetter;

    /**
     * 排序
     */
    @Min(value = 0, message = "排序必须大于等于0")
    @NotNull(message = "排序不能为空")
    private Integer sort;

}
